package com.eshop.commons;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import org.springframework.stereotype.Service;

@Getter
@Setter
@AllArgsConstructor
public class JResponse<T> {
    private int code;
    private T data;
    private String message;

    public static <T> JResponse<T> successful(T data){
        return new JResponse<T>(200,data,"success");
    }

    public static <T> JResponse<T> success(String msg){
        return new JResponse<T>(1,null,msg);
    }

    public static <T> JResponse<T> fail(String msg){
       return new JResponse<>(0,null,msg);
    }
}
